package com.cjq.util;

import com.cjq.bean.WxUser;

import javax.servlet.http.HttpSession;

/*用于传入session之后获取当前登录的用户名和电话*/
public class UserUtil {
    public static String getUserName(HttpSession session){

        return (String) session.getAttribute("adminUserName");
    }

    public static String getUserPhone(HttpSession session){
        return (String) session.getAttribute("loginPhone");
    }

    public static String getLoginSms(HttpSession session,String userPhone){
        return (String)session.getAttribute(userPhone);
    }

    public static void setLoginSms(HttpSession session,String userPhone,String code){
        System.out.println("发送的手机号为"+userPhone+"验证码为："+code);
        session.setAttribute(userPhone,code);
    }

    public static void setWxUser(HttpSession session, WxUser wxUser){
        session.setAttribute("WxUser",wxUser);
    }

    public static WxUser getWxUser(HttpSession session){
        return (WxUser) session.getAttribute("WxUser");
    }
}
